package com.ruoyi.web.controller.common;


import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.system.domain.AppNewsDetailed;
import com.ruoyi.system.service.IAppAttachmentService;
import com.ruoyi.system.service.impl.AppNewsDetailedServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;


public class StockUtils {
    public static void main(String[] args) {
        int[] aa = {1, 2, 3, 4, 5};
        System.out.println(aa.length);
//        URL url = null;
//        String str = "";
//        try {
//            url = new URL("https://hk.ths572.monster:888/api/stock/getStock.do?stockPlate=科创板&pageNum=1&pageSize=15");
//
//            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
//            connection.setRequestMethod("GET");
//            connection.setConnectTimeout(5000);
//            connection.setReadTimeout(5000);
//            if (connection.getResponseCode() == 200) {
//                InputStream inputStream = url.openStream();
//
//                //网站编码
//                BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "utf-8"));
//                String line = "";
//
//                StringBuilder stringBuilder = new StringBuilder();
//
//                line = reader.readLine();
//                stringBuilder.append(line);
//                stringBuilder.append("\n");
//                //拆解json串 取值
//                str = stringBuilder.toString();
//
//                if (str != null && !str.equals("")) {
//                    JSONObject resObject = JSONObject.parseObject(str);
//
//                    reader.close();
//                    inputStream.close();
//                    connection.disconnect();
//                }
//
//
//            } else {
//            }
//
//        } catch (MalformedURLException e) {
//            e.printStackTrace();
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
    }
}
